//
//  DCCarManageViewController.m
//  Driver
//
//  Created by 大橙子 on 2018/11/8.
//  Copyright © 2018 Tomous. All rights reserved.
//

#import "DCCarManageViewController.h"
#import "DCFullViewController.h"
#import "DCEmptyViewController.h"
#import "DCTransportingViewController.h"
#import "DCNewCarViewController.h"
@interface DCCarManageViewController ()
@property (nonatomic, strong) ZWMSegmentController *segmentVC;
@end

@implementation DCCarManageViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.title = @"车辆信息";
    
    UIBarButtonItem *rightItem = [[UIBarButtonItem alloc]initWithImage:IMAGENAME(@"加号 (2)") style:UIBarButtonItemStylePlain target:self action:@selector(rightBarDidClick)];
    self.navigationItem.rightBarButtonItem = rightItem;
    
    [self setUpViewControllers];
}
-(void)setUpViewControllers{
    DCFullViewController *sendOrderVC = [[DCFullViewController alloc] init];
    DCEmptyViewController *quotationVC = [[DCEmptyViewController alloc] init];
    DCTransportingViewController *robVC = [[DCTransportingViewController alloc] init];
    
    NSArray *array = @[sendOrderVC,quotationVC,robVC];
    
    self.segmentVC = [ZWMSegmentController segmentControllerWithFrame:self.view.bounds Titles:@[@"满载",@"空闲/未满载",@"运输中"] type:1];
    self.segmentVC.segmentView.showSeparateLine = YES;
    self.segmentVC.segmentView.segmentTintColor = BlueColor;
    self.segmentVC.viewControllers = [array copy];
    if (array.count==1) {
        self.segmentVC.segmentView.style=ZWMSegmentStyleDefault;
    } else {
        self.segmentVC.segmentView.style=ZWMSegmentStyleFlush;
    }
    [self.segmentVC  enumerateBadges:@[@10,@21,@13]];
    [self addSegmentController:self.segmentVC];
    [self.segmentVC  setSelectedAtIndex:0];
}
-(void)rightBarDidClick {
    DCNewCarViewController *newCar = [[DCNewCarViewController alloc]init];
    [self.navigationController pushViewController:newCar animated:YES];
}
@end
